import 'package:seedfour/generated/json/base/json_convert_content.dart';
import 'package:seedfour/app/models/invite_settles_entity.dart';

InviteSettlesEntity $InviteSettlesEntityFromJson(Map<String, dynamic> json) {
  final InviteSettlesEntity inviteSettlesEntity = InviteSettlesEntity();
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    inviteSettlesEntity.total = total;
  }
  final List<InviteSettlesData>? data = (json['data'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<InviteSettlesData>(e) as InviteSettlesData)
      .toList();
  if (data != null) {
    inviteSettlesEntity.data = data;
  }
  return inviteSettlesEntity;
}

Map<String, dynamic> $InviteSettlesEntityToJson(InviteSettlesEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['total'] = entity.total;
  data['data'] = entity.data?.map((v) => v.toJson()).toList();
  return data;
}

extension InviteSettlesEntityExtension on InviteSettlesEntity {
  InviteSettlesEntity copyWith({
    int? total,
    List<InviteSettlesData>? data,
  }) {
    return InviteSettlesEntity()
      ..total = total ?? this.total
      ..data = data ?? this.data;
  }
}

InviteSettlesData $InviteSettlesDataFromJson(Map<String, dynamic> json) {
  final InviteSettlesData inviteSettlesData = InviteSettlesData();
  final int? createdAt = jsonConvert.convert<int>(json['createdAt']);
  if (createdAt != null) {
    inviteSettlesData.createdAt = createdAt;
  }
  final int? updatedAt = jsonConvert.convert<int>(json['updatedAt']);
  if (updatedAt != null) {
    inviteSettlesData.updatedAt = updatedAt;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    inviteSettlesData.id = id;
  }
  final String? referrerUid = jsonConvert.convert<String>(json['referrerUid']);
  if (referrerUid != null) {
    inviteSettlesData.referrerUid = referrerUid;
  }
  final String? referrerName = jsonConvert.convert<String>(
      json['referrerName']);
  if (referrerName != null) {
    inviteSettlesData.referrerName = referrerName;
  }
  final String? refereeUid = jsonConvert.convert<String>(json['refereeUid']);
  if (refereeUid != null) {
    inviteSettlesData.refereeUid = refereeUid;
  }
  final String? refereeName = jsonConvert.convert<String>(json['refereeName']);
  if (refereeName != null) {
    inviteSettlesData.refereeName = refereeName;
  }
  final int? referrerAt = jsonConvert.convert<int>(json['referrerAt']);
  if (referrerAt != null) {
    inviteSettlesData.referrerAt = referrerAt;
  }
  final String? orderId = jsonConvert.convert<String>(json['orderId']);
  if (orderId != null) {
    inviteSettlesData.orderId = orderId;
  }
  final int? orderAmount = jsonConvert.convert<int>(json['orderAmount']);
  if (orderAmount != null) {
    inviteSettlesData.orderAmount = orderAmount;
  }
  final int? refeAmount = jsonConvert.convert<int>(json['refeAmount']);
  if (refeAmount != null) {
    inviteSettlesData.refeAmount = refeAmount;
  }
  final String? remark = jsonConvert.convert<String>(json['remark']);
  if (remark != null) {
    inviteSettlesData.remark = remark;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    inviteSettlesData.title = title;
  }
  final String? orderDate = jsonConvert.convert<String>(json['orderDate']);
  if (orderDate != null) {
    inviteSettlesData.orderDate = orderDate;
  }
  final int? orderTimestamp = jsonConvert.convert<int>(json['orderTimestamp']);
  if (orderTimestamp != null) {
    inviteSettlesData.orderTimestamp = orderTimestamp;
  }
  final String? statiMonth = jsonConvert.convert<String>(json['statiMonth']);
  if (statiMonth != null) {
    inviteSettlesData.statiMonth = statiMonth;
  }
  final String? benefitUid = jsonConvert.convert<String>(json['benefitUid']);
  if (benefitUid != null) {
    inviteSettlesData.benefitUid = benefitUid;
  }
  final String? benefitName = jsonConvert.convert<String>(json['benefitName']);
  if (benefitName != null) {
    inviteSettlesData.benefitName = benefitName;
  }
  final int? cacelStatus = jsonConvert.convert<int>(json['cacelStatus']);
  if (cacelStatus != null) {
    inviteSettlesData.cacelStatus = cacelStatus;
  }
  return inviteSettlesData;
}

Map<String, dynamic> $InviteSettlesDataToJson(InviteSettlesData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createdAt'] = entity.createdAt;
  data['updatedAt'] = entity.updatedAt;
  data['id'] = entity.id;
  data['referrerUid'] = entity.referrerUid;
  data['referrerName'] = entity.referrerName;
  data['refereeUid'] = entity.refereeUid;
  data['refereeName'] = entity.refereeName;
  data['referrerAt'] = entity.referrerAt;
  data['orderId'] = entity.orderId;
  data['orderAmount'] = entity.orderAmount;
  data['refeAmount'] = entity.refeAmount;
  data['remark'] = entity.remark;
  data['title'] = entity.title;
  data['orderDate'] = entity.orderDate;
  data['orderTimestamp'] = entity.orderTimestamp;
  data['statiMonth'] = entity.statiMonth;
  data['benefitUid'] = entity.benefitUid;
  data['benefitName'] = entity.benefitName;
  data['cacelStatus'] = entity.cacelStatus;
  return data;
}

extension InviteSettlesDataExtension on InviteSettlesData {
  InviteSettlesData copyWith({
    int? createdAt,
    int? updatedAt,
    int? id,
    String? referrerUid,
    String? referrerName,
    String? refereeUid,
    String? refereeName,
    int? referrerAt,
    String? orderId,
    int? orderAmount,
    int? refeAmount,
    String? remark,
    String? title,
    String? orderDate,
    int? orderTimestamp,
    String? statiMonth,
    String? benefitUid,
    String? benefitName,
    int? cacelStatus,
  }) {
    return InviteSettlesData()
      ..createdAt = createdAt ?? this.createdAt
      ..updatedAt = updatedAt ?? this.updatedAt
      ..id = id ?? this.id
      ..referrerUid = referrerUid ?? this.referrerUid
      ..referrerName = referrerName ?? this.referrerName
      ..refereeUid = refereeUid ?? this.refereeUid
      ..refereeName = refereeName ?? this.refereeName
      ..referrerAt = referrerAt ?? this.referrerAt
      ..orderId = orderId ?? this.orderId
      ..orderAmount = orderAmount ?? this.orderAmount
      ..refeAmount = refeAmount ?? this.refeAmount
      ..remark = remark ?? this.remark
      ..title = title ?? this.title
      ..orderDate = orderDate ?? this.orderDate
      ..orderTimestamp = orderTimestamp ?? this.orderTimestamp
      ..statiMonth = statiMonth ?? this.statiMonth
      ..benefitUid = benefitUid ?? this.benefitUid
      ..benefitName = benefitName ?? this.benefitName
      ..cacelStatus = cacelStatus ?? this.cacelStatus;
  }
}